package cn.tedu.boot41.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {
    @RequestMapping("/test01")
    public String test01(){
        return "接收到了请求";
    }
    @RequestMapping("/test02")
    public String test02(String info){
        return "接收到了:"+info;
    }
    @RequestMapping("/bmi")
    public String bmi(float height, float weight){
        System.out.println(height + "-" + weight);
        float bmi = weight/(height*height);
        //偏瘦 18.5 标准 24 微胖 28 比较胖
        if (bmi < 18.5) {
            return "兄弟你瘦了!";
        }else if (bmi < 24){
            return "身体倍儿棒!";
        }else if (bmi < 28){
            return "微微胖!";
        }else {
            return "兄弟该运动起来了";
        }
    }
    @RequestMapping("/check")
    public String check(String username){
        if ("tom".equals(username)) {
            return "用户名已存在!";
        }
        return "用户名可用!";
    }
}
